package studay.factory.simple;

import studay.factory.ali.AliPay;
import studay.factory.PayFactory;
import studay.factory.wechat.WeChatPay;

/**
 * @program: 设计模式
 * @description: 简单支付工厂
 * @author: Tom
 * @create: 2022-01-05 21:01
 **/
public class SimplePayFactory {

    /**
     * 根据类型选择支付对象
     * @param payTye
     * @return
     */
    public static PayFactory createPay(String payTye){

        if(payTye == null){
            return null;
        }
        if (payTye.equalsIgnoreCase("WECHAT_PAY")){
            return new WeChatPay();
        }else if(payTye.equalsIgnoreCase("ALI_PAY")){
            return new AliPay();
        }
        return null;

    }
}
